package com.chen.jwtbase.system.exception;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Map;

/**
 * @ClassName ErrorMessage
 * @Description
 * @Author Mr-CHEN
 * @Date 2019/9/29 0029 10:14
 * @Version V1.0
 **/

@Data
@AllArgsConstructor
public class ErrorMessage {
    private int code;
    private String message;
    private Map<String,Object> details;

    public ErrorMessage(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public <T> ErrorMessage withDetails(String key, T value){
        details.put(key,value);
        return this;
    }
}